/*
 * Copyright (C) 2006-2012 Zbjk All rights reserved
 * Author: wangchong
 * Date: 2014-1-20
 * Description:BusinessException.java 
 */
package com.metal.silver.exception;

import lombok.Data;

/**
 * 业务异常
 * @author wangchong
 * 
 */
@Data
public class BusinessException extends RuntimeException {

    /**
     * 序列化使用
     */
    private static final long serialVersionUID = 1L;

    private ResponseCode responseCode;
    private Object causeData;

    public BusinessException(ResponseCode errorCode) {
        super(errorCode.toString());
        this.responseCode = errorCode;
    }

    public BusinessException(ResponseCode errorCode, Object causeData) {
        super(errorCode.toString());
        this.responseCode = errorCode;
        this.causeData = causeData;
    }

    public BusinessException(ResponseCode errorCode, Throwable cause) {
        super(errorCode.toString(), cause);
        this.responseCode = errorCode;
    }
    public BusinessException(String msg, ResponseCode errorCode) {
        super(msg);
        this.responseCode = errorCode;
    }

    /**
     * @return the errorCode
     */
    public ResponseCode getErrorCode() {
        return responseCode;
    }
}
